package com.cskaoyan.javase.oop3._1interface._4chain;

/**
 * @description: 链式调用
 * @author: wuguidong@cskaoyan.onaliyun.com
 **/

/**
 * 链式调用的前提是,前面方法调用的结果仍然是一个对象,然后就可以继续调用方法
 * 实际开发中比较常见
 *
 *
 */
public class Demo {
    public static void main(String[] args) {
        //这种调用形式就称之为链式调用
        new Student().getStudent().getTeacher().show();

        System.out.println();
    }
}

class Student {
    public Student getStudent() {
        return new Student();
    }

    public Teacher getTeacher() {
        return new Teacher();
    }
}

class Teacher {
    public void show() {
        System.out.println("秀一波~~~");
    }
}